{extend name="public/base"/}
{block name="style"}
{/block}
{block name="content"}
    <div class="data-list" data-url="{:url('index')}">
        <form class="layui-form inline-form">
            <div class="pull-left">
                <div class="layui-inline">
                    <input type="text" name="sn" autofocus id="type-sn" placeholder="输入单号" class="layui-input input-order-sn">
                </div>
                <div class="layui-inline">
                    <select name="check_status" lay-filter="data-list" lay-search>
                        <option value="">审批状态</option>
                        {foreach $check_status as $k => $s}
                        <option value="{$k}">{$s}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-inline">
                    <select name="producer_id" lay-filter="data-list" lay-search>
                        <option value="">供应商</option>
                        {foreach $producer as $p}
                        <option value="{$p.producer_id}">{$p.name}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-inline">
                    <select name="status" lay-filter="data-list" lay-search>
                        <option value="">退货状态</option>
                        {foreach $status as $k => $s}
                        <option value="{$k}">{$s}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-inline">
                    <select name="buyer_user_id" lay-filter="data-list" lay-search>
                        <option value="">采购员</option>
                        {foreach $buyers as $b}
                        <option value="{$b.id}">{$b.nickname}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layui-btn-sm layui-btn-normal search"><i class="layui-icon layui-icon-search"></i></button>
                </div>
            </div>
        </form>
        <div class="layui-row form-lists-button">
            <div class="layui-inline layui-btn-group">
                <a id="batch-cancel" class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon layui-icon-logout"></i>批量取消</a>
            </div>
            <a href="{:url('cancel')}" title="批量取消" confirm="1" id="hidden-cancel" class="ajax-get layui-hide"></a>
        </div>
        <div class="data">
            <p><i class="fa fa-spinner fa-spin"></i> 加载中...</p>
        </div>
    </div>
{/block}
{block name="script"}
<script type="text/javascript">
layui.use(['layer', 'jquery'], function()
{
    var layer = layui.layer
        , $ = layui.jquery;
    $("#batch-cancel").click(function()
    {
        var ids = getIds('.exchange-id');
        if(ids.length < 1)
        {
            layer.msg("请选择要取消的换货单");
            return false;
        }
        var $cancel = $("#hidden-cancel"), oldUrl = $cancel.attr("href");
        $cancel.attr("href", oldUrl + "?ids=" + ids.join(',')).click().attr("href", oldUrl);
    });
});
</script>
{/block}